package team.seekers.catering.common.enums;

import com.baomidou.mybatisplus.core.enums.IEnum;
import lombok.Getter;

import java.util.Arrays;

/**
 * 饮食意向枚举
 */
@Getter
public enum FoodAmountTypeEnum implements IEnum<Integer> {


    MICRO(0, "微碳水100kcal","1大份，不加蛋白"),
    LOW(1,  "低碳水150kcal","1大份1小份，不加蛋白"),
    MID(2, "中碳水200kcal","2大份，不加蛋白"),
    HIGH(3,  "重碳水300kcal","3大份，不加蛋白"),
    MICRO_ENTRANCE(4, "微碳水增肌100kcal（加蛋白加钱）","1大份，加蛋白"),
    LOW_ENTRANCE(5,  "低碳水增肌150kcal（加蛋白加钱）","1大份1小份，加蛋白"),
    MID_ENTRANCE(6, "中碳水增肌200kcal（加蛋白加钱）","2大份，加蛋白"),
    HIGH_ENTRANCE(7,  "重碳水增肌300kcal（加蛋白加钱）","3大份，加蛋白"),
    LOW_LOSE(8, "低碳水减脂档100kcal（给的是微碳水的量）","1大份，不加蛋白"),
    MID_LOSE(9,  "中碳水减脂档150kcal（给的是低碳水的量）","1大份1小份，不加蛋白"),
    HIGH_LOSE(10, "重碳水减脂档200kcal（给的是中碳水的量）","2大份，不加蛋白"),

    ;

    private int type;

    private String name;

    private String amount;

    FoodAmountTypeEnum(int type, String name, String amount) {
        this.type = type;
        this.name = name;
        this.amount = amount;
    }

    @Override
    public Integer getValue() {
        return this.type;
    }

    public static FoodAmountTypeEnum getByType(int type) {
        return Arrays.stream(values()).filter(e -> e.getType() == type).findFirst().orElse(null);
    }

    public static FoodAmountTypeEnum getByName(String name) {
        return Arrays.stream(values()).filter(e -> e.getName().equals(name)).findFirst().orElse(null);
    }
}
